<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
    .current{
        color:orangered;
    }
    .bg{
        background:plum;
    }
    .fs{
        font-size: 30px;
    }
    </style>
</head>
<body>
    <p id="test" class="current bg">hello world</p>
    <script>
    // ele.style.cssAttr
    // ele.className
    // ele.style.cssText
    /* ele.classList 获取的是一个class的集合
    ele.classList.add() 
    ele.classList.remove()
    ele.classList.toggle()-->在add和remove之间切换
    ele.classList.contains()-->是否包含某个class，结果返回boolean值
    */
    var test=document.getElementById("test");
    console.log(test.classList[1])
    test.onclick=function(){
        // this.style.backgroundColor="#999"
        // this.className="current";
        // this.style.cssText="color:red;font-size:30px;background-color:yellow"
        // this.classList.add("fs");
        this.classList.toggle("current");
        console.log(this.classList.contains("current"));
    }
    </script>
</body>
</html>